[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
A_AVERAGE()
Return the average of the contents of a numerical array
-------------------------------------------------------------------------------
Syntax
A_AVERAGE( <aTarget>,
[<idxPos>],
[<nCount>] ) -> nAverage
Arguments
<aTarget> is the FlexFile array on which to perform the average.
<idxPos> The index (or subscript) is the position in the target
array at which to begin the average. The default is the first
element.
<nCount> is the number of elements to include in the average. The
default is all element starting at <idxPos> to the end of the
array.
Returns
A_AVERAGE() returns the numerical average or mean of the <aTarget>
array. On error, A_AVERAGE() returns 0.
Description
A_AVERAGE() will average all or a part of a FlexFile numeric
array. The numeric types are (D)ouble, (F)loat, (L)ong or (UL),
(I)nteger or (UI), and (T)iny or (UT).
The averaging begins at the position pointed to by <idxPos> and
continues for <nCount> elements. The function will wrap around
dimensions if count extends beyond the end of the current row.
Examples
// Declare a two dimensional (L)ong integer array
LOCAL rows, cols
rows = 10
cols = 20
aLong = A_DECLARE( "L", rows, cols )
// Fill the 5th row with 100,000 and the 6th row
// with 200,000.
A_FILL( aLong, 100000, A_( 5, 1 ), cols )
A_FILL( aLong, 200000, A_( 6, 1 ), cols )
// Take the average of rows 5 and six.
? A_AVERAGE( aLong, A_( 5, 1 ), cols * 2 ) // Result: 150000
See Also:
A_STORE()
A_RETRIEVE()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson